
package saxon.gui.model;

import java.io.File;
import java.io.FileFilter;
import java.util.regex.Pattern;

/**
 *
 * @author lennyn
 */
class RegexpFileFilter implements FileFilter {
	private final Pattern pattern;

	public RegexpFileFilter(String regexp) {
		pattern = Pattern.compile(regexp);
	}

	@Override
	public boolean accept(File file) {
		return file.isFile() && pattern.matcher(file.getName()).matches();
	}
}
